php string search in array

34

// Search a partial string matching in array elements
function array_search_partial($arr, $keyword) {
    foreach($arr as $index => $string) {
        if (strpos($string, $keyword) !== FALSE)
            return $index;
    }
}

Comments

Submit
0 Comments